import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const WeatherMetricsMeta: IPublicTypeComponentMetadata = {
  componentName: 'WeatherMetrics',
  title: '雨量风速湿度',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'WeatherMetrics',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'tabs',
      propType: 'array',
      description: '指标标签列表'
    },
    {
      name: 'activeBackgroundImage',
      propType: 'string',
      description: '活跃状态背景图'
    },
    {
      name: 'inactiveBackgroundImage',
      propType: 'string',
      description: '非活跃状态背景图'
    },
    {
      name: 'actionIcon',
      propType: 'string',
      description: '操作图标'
    },
    {
      name: 'activeTextColor',
      propType: 'string',
      description: '活跃状态文字颜色'
    },
    {
      name: 'inactiveTextColor',
      propType: 'string',
      description: '非活跃状态文字颜色'
    },
    {
      name: 'borderColor',
      propType: 'string',
      description: '边框颜色'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '背景颜色'
    },
    {
      name: 'showActionIcon',
      propType: 'bool',
      description: '显示操作图标'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onTabClick',
      propType: 'func',
      description: '标签点击事件'
    },
    {
      name: 'onActionIconClick',
      propType: 'func',
      description: '操作图标点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'activeBackgroundImage',
        title: { label: { type: 'i18n', 'en-US': 'activeBackgroundImage', 'zh-CN': '活跃背景图' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz149.png' }
      },
      {
        name: 'inactiveBackgroundImage',
        title: { label: { type: 'i18n', 'en-US': 'inactiveBackgroundImage', 'zh-CN': '非活跃背景图' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/jxbf.png' }
      },
      {
        name: 'actionIcon',
        title: { label: { type: 'i18n', 'en-US': 'actionIcon', 'zh-CN': '操作图标' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz9.png' }
      },
      {
        name: 'activeTextColor',
        title: { label: { type: 'i18n', 'en-US': 'activeTextColor', 'zh-CN': '活跃文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'inactiveTextColor',
        title: { label: { type: 'i18n', 'en-US': 'inactiveTextColor', 'zh-CN': '非活跃文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
      },
      {
        name: 'borderColor',
        title: { label: { type: 'i18n', 'en-US': 'borderColor', 'zh-CN': '边框颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#3A4E74' }
      },
      {
        name: 'backgroundColor',
        title: { label: { type: 'i18n', 'en-US': 'backgroundColor', 'zh-CN': '背景颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(5,18,34,0.2)' }
      },
      {
        name: 'showActionIcon',
        title: { label: { type: 'i18n', 'en-US': 'showActionIcon', 'zh-CN': '显示操作图标' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '雨量风速湿度',
    screenshot: '',
    schema: {
      componentName: 'WeatherMetrics',
      props: {
        width: 500,
        height: 150,
        tabs: [
          { id: '1', text: '2、3小时雨量', isActive: true },
          { id: '2', text: '24小时雨量', isActive: false },
          { id: '3', text: '24小时风速', isActive: false },
          { id: '4', text: '24小时温度', isActive: false }
        ],
        activeBackgroundImage: 'http://localhost:8085/static/images/qixiangfangzhai/bz149.png',
        inactiveBackgroundImage: 'http://localhost:8085/static/images/qixiangfangzhai/jxbf.png',
        actionIcon: 'http://localhost:8085/static/images/qixiangfangzhai/bz9.png',
        activeTextColor: '#FFFFFF',
        inactiveTextColor: 'rgba(255,255,255,0.9)',
        borderColor: '#3A4E74',
        backgroundColor: 'rgba(5,18,34,0.2)',
        showActionIcon: true,
        theme: 'dark'
      }
    }
  }
];

export default {
  ...WeatherMetricsMeta,
  snippets
};
